//
//  VideoWindow.m
//  HCVideoModule
//
//  Created by 蒋千秋 on 2021/9/23.
//

#import "VideoWindow.h"

@implementation VideoWindow

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        if ([UIDevice currentDevice].systemVersion.intValue == 9) { // Fix bug for keyboard in iOS 9
            self.windowLevel = CGFLOAT_MAX;
        } else {
            self.windowLevel = UIWindowLevelAlert;
        }
        self.dragEnable = YES;
        self.isKeepBounds = YES;
        self.backgroundColor = UIColor.redColor;
    }
    return self;
}
- (void)setIsMinShow:(BOOL)isMinShow {
    _isMinShow = isMinShow;
    if (isMinShow) {
        [UIView animateWithDuration:kAnimationDuration animations:^{
            self.frame = CGRectMake(kScreenWidth - 150, 80,kMinVideoWidth, kMinVideoHeight);
        }];
        self.dragEnable = YES;
        [self addSingleTap];
    }else {
        [UIView animateWithDuration:kAnimationDuration animations:^{
            self.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight);
        }];
        self.dragEnable = NO;
        [self removeSingleTap];
    }
}
@end
